# $Id$
# Maintainer: Ricky Wu <rickleaf.wu@gmail.com>

_realname=gdl2
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2.31.2
pkgrel=2
pkgdesc="GNOME Docking Library (mingw-w64)"
arch=('any')
license=('LGPL 2')
url="https://www.gnome.org/"
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-libxml2")
makedepends=("intltool"
             "gtk-doc")
options=('strip' 'staticlibs')
source=(https://download.gnome.org/sources/${_realname:0:3}/${pkgver:0:4}/${_realname:0:3}-${pkgver}.tar.gz
        '001-pixbuf.patch'
        '002-headers.patch')
sha256sums=('8a450b89e4571750b61f7e6450d5abc16d7d3e526709dd2d8b47317a2090cf3d'
            '7d9fd1c17a55d754dab63d662a3b3d8fcd98506b6531df192b446eeee03ad2a4'
            'SKIP')

prepare() {
  cd "${srcdir}"/${_realname:0:3}-${pkgver}

  patch -b -V simple -p1 -i ${srcdir}/001-pixbuf.patch
  patch -b -V simple -p1 -i ${srcdir}/002-headers.patch

  autoreconf -f -i
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  mkdir -p docs/reference/html
  cp -rf ../${_realname:0:3}-${pkgver}/docs/reference/html/* docs/reference/html

  ../${_realname:0:3}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --enable-introspection=no
  make
}

package() {
  cd "$srcdir/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install

  install -Dm644 "${srcdir}/${_realname:0:3}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
